//
//  HomePageCollectionViewCell.m
//  Menu
//
//  Created by YouLu on 15/7/3.
//  Copyright (c) 2015年 lijiangang. All rights reserved.
//

#import "HomePageCollectionViewCell.h"

@implementation HomePageCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubviews];
    }
    
    return self;
}
-(void)createSubviews
{
    self.bigImageView = [[UIImageView alloc] initWithFrame:self.contentView.frame];
    [self.contentView addSubview:self.bigImageView];
    [_bigImageView release];
    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(20*WIDTH, 40*HEIGHT, 300*WIDTH, 30*HEIGHT)];
    self.nameLabel.textColor = [UIColor whiteColor];
    self.nameLabel.font = [UIFont systemFontOfSize:17*WIDTH];
    [self.bigImageView addSubview:self.nameLabel];
    [_nameLabel release];
    
    self.englishNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(20*WIDTH, 55*HEIGHT, 300*WIDTH, 30*HEIGHT)];
    self.englishNameLabel.textColor = [UIColor whiteColor];
    self.englishNameLabel.font = [UIFont systemFontOfSize:13*WIDTH];
    [self.bigImageView addSubview:self.englishNameLabel];
    [_englishNameLabel release];
    
    self.pageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(180*WIDTH, 500*HEIGHT, 200*WIDTH, 10*HEIGHT)];
    self.pageControl.backgroundColor = [UIColor clearColor];
    self.pageControl.numberOfPages = 10;
    self.pageControl.currentPage = 0;
    self.pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
    self.pageControl.pageIndicatorTintColor = [UIColor whiteColor];
    [self addSubview:self.pageControl];
    [_pageControl release];
    
}
-(void)pageControlPage:(NSInteger)page
{

    self.pageControl.currentPage = page;
    
}
-(void)setHomePageModel:(HomePageModel *)homePageModel
{
    if (_homePageModel != homePageModel) {
        [_homePageModel release];
        _homePageModel = [homePageModel retain];
    }
    [self.bigImageView sd_setImageWithURL:[NSURL URLWithString:self.homePageModel.imagePathLandscape] placeholderImage:[UIImage imageNamed:@"homePlace.png"]];
    self.nameLabel.text = self.homePageModel.name;
    self.englishNameLabel.text = self.homePageModel.englishName;
}
@end
